const webpack = require('webpack');
const path = require('path')
const CompressionPlugin = require("compression-webpack-plugin")//gzip压缩

let rootPath = process.env.VUE_APP_ROOT;

module.exports = {

    publicPath: '/' + rootPath,

    outputDir: rootPath,

    devServer: {
        open: false,
        port:8080,
        // proxy: {
        //   '/': {
        //     target: 'http://171.217.93.19:8089',// 目标地址
        //     changeOrigin: true,// 是否跨域
        //     //  路径重写，也就是说当路径为http://localhost:8080/hello 写成 /hello就可以了
        //     pathRewrite: {
        //       '^/': ''
        //     }
        //   }
        // }
    },

    productionSourceMap: false,

    configureWebpack: {
        plugins: [
            new webpack.ProvidePlugin({
                _: "lodash",
                $: 'jquery',
                $uuid: 'node-uuid',
                $moment: 'moment',
                axios: 'axios',
                L: "leaflet",
            }),
            new CompressionPlugin({
                test:/\.js$|\.html$|.\css/, //匹配文件名
                threshold: 10240,//对超过10k的数据压缩
                deleteOriginalAssets: false //不删除源文件
            })
        ]
    },

}
